package mc

import (
	"gitee.com/dreamwood/ez-go/db/mgo"
)

const (
	BuyOrderPaymentEventNew           = "erp.BuyOrderPaymentNew"
	BuyOrderPaymentEventBeforeCreate  = "erp.BuyOrderPaymentBeforeCreate"
	BuyOrderPaymentEventBeforeUpdate  = "erp.BuyOrderPaymentBeforeUpdate"
	BuyOrderPaymentEventBeforeSave    = "erp.BuyOrderPaymentBeforeCreate erp.BuyOrderPaymentBeforeUpdate"
	BuyOrderPaymentEventAfterCreate   = "erp.BuyOrderPaymentAfterCreate"
	BuyOrderPaymentEventAfterUpdate   = "erp.BuyOrderPaymentAfterUpdate"
	BuyOrderPaymentEventAfterSave     = "erp.BuyOrderPaymentAfterCreate erp.BuyOrderPaymentAfterUpdate"
	BuyOrderPaymentEventDelete        = "erp.BuyOrderPaymentDelete"
	BuyOrderPaymentAccessControlEvent = "erp.BuyOrderPaymentAccessControl"
)

func GetBuyOrderPaymentConfig() *mgo.DocConfig {
	return BuyOrderPayment_Config
}

var BuyOrderPayment_Config *mgo.DocConfig

func init() {
	BuyOrderPayment_Config = NewBuyOrderPaymentConfig()
}
func NewBuyOrderPaymentConfig() *mgo.DocConfig {
	return &mgo.DocConfig{
		ContainerKey: "erp.BuyOrderPayment",
		Fields: []string{
			"belongTo", "type", "money", "applyEmp", "payAt", "payFeed", "payEmp", "isPay", "isLock",
		},
		RelationFields: []string{
			"belongTo", "type", "applyEmp", "payEmp",
		},
		RelationConfigs: map[string]*mgo.DocRelation{
			"belongTo": {
				Config:     GetBuyOrderConfig,
				DocName:    "BuyOrder",
				JoinType:   "O",
				KeyInside:  "belongToId",
				KeyOutSide: "id",
			},
			"type": {
				Config:     GetBuyOrderPayTypeConfig,
				DocName:    "BuyOrderPayType",
				JoinType:   "O",
				KeyInside:  "typeId",
				KeyOutSide: "id",
			},
			"applyEmp": {
				Config:     GetEmpConfig,
				DocName:    "Emp",
				JoinType:   "O",
				KeyInside:  "applyEmpId",
				KeyOutSide: "id",
			},
			"payEmp": {
				Config:     GetEmpConfig,
				DocName:    "Emp",
				JoinType:   "O",
				KeyInside:  "payEmpId",
				KeyOutSide: "id",
			},
		},
		FieldFilter: map[string]*mgo.DocFieldFilter{
			"default": {
				Select: []string{},
				Omit:   []string{},
			},
		},
	}
}
